package cn.darkhorse.core.param;

import cn.darkhorse.entity.BpmnWorkflowParam;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
import java.util.Map;

/**
 * @author yuanjun
 * @since 2020/6/3 17:25
 */
public class ParserStrategy4TaskRelativePost extends ParserStrategy4TaskGroup implements IParamParserStrategy {

    public ParserStrategy4TaskRelativePost(IUser iUser) {
        super(iUser);
    }

    @Override
    public Map<String, Object> parse(BpmnWorkflowParam param) {
        Map<String, Object> resultMap = super.parse(param);
        if ( null == resultMap) { return null; }

        for (Map.Entry<String, Object> entry : resultMap.entrySet()) {
            List<String> users = (List<String>) entry.getValue();
            entry.setValue(StringUtils.join(users.toArray(),","));
        }

        return resultMap;
    }
}
